import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DiseaseHistoryVO, DiseaseHistoryForm, DiseaseHistoryQuery } from '@/api/stroke/diseaseHistory/types';

/**
 * 查询疾病史列表
 * @param query
 * @returns {*}
 */

export const listDiseaseHistory = (query?: DiseaseHistoryQuery): AxiosPromise<DiseaseHistoryVO[]> => {
  return request({
    url: '/stroke/diseaseHistory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询疾病史详细
 * @param id
 */
export const getDiseaseHistory = (id: string | number): AxiosPromise<DiseaseHistoryVO> => {
  return request({
    url: '/stroke/diseaseHistory/' + id,
    method: 'get'
  });
};

/**
 * 新增疾病史
 * @param data
 */
export const addDiseaseHistory = (data: DiseaseHistoryForm) => {
  return request({
    url: '/stroke/diseaseHistory',
    method: 'post',
    data: data
  });
};

/**
 * 修改疾病史
 * @param data
 */
export const updateDiseaseHistory = (data: DiseaseHistoryForm) => {
  return request({
    url: '/stroke/diseaseHistory',
    method: 'put',
    data: data
  });
};

/**
 * 删除疾病史
 * @param id
 */
export const delDiseaseHistory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/diseaseHistory/' + id,
    method: 'delete'
  });
};
